package dyyx;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.rpc.service.EchoService;

// 直连 不走注册中心
public class ClientMain2 {

	public static void main(final String[] args) {
		
		ApplicationConfig application = new ApplicationConfig();
		application.setName("dubbo-client-main");
		
		ReferenceConfig<HelloService> referenceConfig = new ReferenceConfig<>();
		referenceConfig.setApplication(application);
		referenceConfig.setInterface(HelloService.class);
		referenceConfig.setUrl("dubbo://127.0.0.1:20880");
		referenceConfig.setVersion("1.0.0");
		referenceConfig.setGroup("group1");
		
		HelloService helloService = referenceConfig.get();
		String result = helloService.hello("dyyx");
		
		System.out.println(result);
		
		Pet pet = new Pet();
		pet.name="tiger";
		pet = helloService.getPet(pet);
		
		System.out.println(pet.name);


		EchoService echoService = (EchoService) helloService;
		System.out.println(echoService.$echo("hello"));
		
		
		
	}

}
